import 'package:flutter/material.dart';
import 'package:untitled5/discover_child_page.dart';

class discoverCell extends StatelessWidget {
  final String title;
  final String subTitle;
  final String imageName;
  final String subImageName;
  final String zsImageName;
  final String ImagePosition;

  discoverCell(
      {super.key,
      required this.title,
      required this.subTitle,
      required this.imageName,
      required this.subImageName,
      required this.zsImageName,
      this.ImagePosition = ''});

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: () {
        // print('hhhhh $title');
        Navigator.of(context).push(MaterialPageRoute(
          builder: (BuildContext context) => DiscoverChildPage(title: title),
        ));
      },
      child: Container(
        color: Colors.white,
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: [
            //左
            Container(
              padding: EdgeInsets.all(10),
              child: Row(
                children: [
                  Image(
                    image: AssetImage(imageName),
                    width: 20,
                    height: 20,
                  ),
                  SizedBox(
                    width: 15,
                  ),
                  Text(title),
                ],
              ),
            ),
            //右
            Container(
              padding: EdgeInsets.all(10),
              child: Row(
                children: [
                  subImageName != ''
                      ? Container(
                          padding: EdgeInsets.symmetric(horizontal: 3),
                          child: Stack(
                            children: [
                              ClipRRect(
                                borderRadius: BorderRadius.circular(4),
                                child: Container(
                                  child: Center(
                                    child: Image(
                                      image: AssetImage(subImageName),
                                      width: 25,
                                      height: 25,
                                    ),
                                  ),
                                ),
                              ),
                              Transform.translate(
                                offset: Offset(20.5, -2.5),
                                child: Container(
                                  width: 6,
                                  height: 6,
                                  decoration: BoxDecoration(
                                      color: Colors.red,
                                      borderRadius: BorderRadius.circular(3)),
                                ),
                              )
                            ],
                          ),
                        )
                      : Container(),
                  subTitle != ''
                      ? Text(
                          subTitle,
                          style: TextStyle(fontSize: 11, color: Colors.grey),
                        )
                      : Text(''),
                  zsImageName != ''
                      ? Container(
                          child: Row(
                            children: [
                              Container(
                                padding: EdgeInsets.symmetric(
                                  horizontal: 3,
                                ),
                                child: Image(
                                  image: AssetImage('images/aixin.png'),
                                  width: 10,
                                  height: 10,
                                ),
                              ),
                              Container(
                                width: 6,
                                height: 6,
                                decoration: BoxDecoration(
                                    color: Colors.red,
                                    borderRadius: BorderRadius.circular(3)),
                              )
                            ],
                          ),
                        )
                      : Container(),
                  Image(
                    image: AssetImage('images/jiantou.png'),
                    width: 20,
                    height: 20,
                  )
                ],
              ),
            ),
          ],
        ),
      ),
    );
  }
}
